package com.hqyj.controller;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.hqyj.pojo.R;
import com.hqyj.pojo.UserInfo;
import com.hqyj.service.UserInfoService;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author rock
 * @since 2022-10-27 10:24:35
 */
@RestController
@RequestMapping("/user-info")
public class UserInfoController {

    @Autowired
    UserInfoService userInfoService;

    //发送验证码
    @PostMapping("/sendCode")
    public R sendCode(String email){
        return userInfoService.sendCode(email);
    }


    //短信发送验证码
    @PostMapping("/smsSendCode")
    public R smsSendCode(String phone) throws TencentCloudSDKException, JsonProcessingException {
        return userInfoService.smsSendCode(phone);
    }
    //验证验证码是否正确
    @PostMapping("/codeVidate")
    public R codeVidate(UserInfo userInfo){
        return userInfoService.codeValiede(userInfo);
    }


}

